// let list = new Array(15).fill(0).map((item, index) => {
//   return {
//     id: +`${index + 1}`,
//     name: `用户【${index + 1}】`,
//     age: Math.floor(Math.random() * 10 + 20),
//   };
// });

import Mock from "mockjs";

const list = Mock.mock({
  // 20条数据
  "data|80": [
    {
      //医院名称
      // goodsName: "@ctitle(5)",
      hospitalName: "@ctitle(3)宠物医院",
      // 医院Id
      "goodsId|+1": 1,
      //医院地址
      hospitalAddress: "@county(true)",
      //评价★
      //   "goodsStar|1-5": "★",
      "phone|13800000000-13899999999": 30,
 //商品等级评价★
 "goodsStar|1-5": "★",
      //图片
      goodsImg: "@Image('100x100','@color','小甜甜')",
      // 邮箱：
      email: "@email",
      // 颜色
      color: "@color",
      name: "@cname()",
      time: "10:00-21:00",
      petName: "@ctitle(2)",
      host: "伍小姐",
      petType: "边牧",
      Vaccinetype: '狂犬疫苗',
      "vaccine|1":["狂犬疫苗","卫佳五"],
      "sex|1":["男","女"],
      yuyuetime: "@now('minute')",
      title:
      "幼犬二联苗今日已到苗，家里狗子需接种疫苗的铲屎官可来我中心预约接种！",
      content: '@csentence(1,20)',

   
      number:"0@goodsId",
    },
  ],
});

class MockService {
  // 获取服务列表
  getServerList(current_page: number, page_size: number, value?: string) {
    console.log(current_page, page_size)
    let newList = value ? list.data.filter((item: any) => {
      return item.hospitalName.includes(value)
    }) : list.data;
    newList = newList.slice(
      (current_page - 1) * page_size,
      (current_page - 1) * page_size + page_size
    );
    return Promise.resolve({
      status: 0,
      result: newList,
    });
  }

  // removeItem(id: number) {
  //   list = list.filter((item) => {
  //     return item.id !== id;
  //   });
  //   return Promise.resolve({
  //     status: 0,
  //     msg: "删除成功",
  //   });
  // }
}

export const mockService = new MockService();
